package com.ry.est.req;

import com.ry.est.annotations.TemporalIntervalTimeSegment;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Future;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @author ry
 * @since 2021-11-10 09:10
 **/
@Data
public class SubmitOrderRequest {
    @NotNull(message = "评估id不能为空")
    private Long evaluateId;

    @NotNull(message = "联系人手机号不能为空")
    @Pattern(regexp = "1[356789]\\d{9}",message = "手机号码不正确")//正则表达式

    //1第二位位356789后面跟着9位数字
    private String phone;

    @NotNull(message = "预约维修地址不能为空")
    @Size(message = "预约维修地址信息的长度在2-50个字之间",min = 2,max = 50)
    private String adress;

    @NotNull(message = "验证码不能为空")
    @Size(message = "验证码的长度只能是6个数字")
    private String sms;

    @NotNull(message = "预约日期不能为空")
//    @Future(message = "时间只能是将来的")//表示日期只能是未来的
//    @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss")
    private Date appintDate;

    @TemporalIntervalTimeSegment(values = {1,2,3,4})
    @NotNull(message = "预约时间段不能为空")
    private Integer temporalInterval;
}
